<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@taglib uri="/WEB-INF/fn.tld" prefix="fn"%>
<%@taglib uri="/WEB-INF/el.tld" prefix="el"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<c:import url="/includes/css_inc.jsp"/>
		<c:import url="/includes/js_inc.jsp"/>
		<script>
			$(function(){
		        $("#search").button({
		            icons: {
		                primary: "ui-icon-search"
		            }
		        }).click(function(){
				});

				$("#btnAdd").button({
		            icons: {
		                primary: "ui-icon-plusthick"
		            }
				}).click(function(){
					$("#job").val("add");
					$("#searchForm").submit();
				});

		        $("[name=btnEdit]").button({
		            icons: {
		                primary: "ui-icon-pencil"
		            },
            		text: false
		        });
		        $("[name=btnDel]").button({
		            icons: {
		                primary: "ui-icon-closethick"
		            },
            		text: false
		        });
			});
			function view(timestamps) {
				window.location='${pageContext.request.contextPath}/acc6?app=ACC60111&job=view&code='+timestamps;
			}
			function del(timestamps) {
				if(confirm('คุณต้องการลบรายการ?')==true){
					window.location='${pageContext.request.contextPath}/acc6?app=ACC60111&job=del&code='+timestamps;
				}
			}
		</script>
	</head>
	<body>
		<c:import url="/apps/msg.jsp"/>
		<c:set var="auth" value="${el:getMapValue(menuAuth, 'ACC60110')}"/>
		<form class="acc67-form" name="searchForm" id="searchForm" action="${pageContext.request.contextPath}/acc6" method="post">
		<input type="hidden" name="app" id="app" value="ACC60111"/>
		<input type="hidden" name="job" id="job" value="search"/>
		<table width="100%" class="ui-widget ui-widget-content" border="0">
			<tr>
				<th align="left" class="acc67-header ui-widget-header" colspan="2"><b>${screenCode.ACC60110}</b></th>
			</tr>
			<tr>
				<td colspan="2" align="right">
					<button type="button" name="btnAdd" id="btnAdd" class="acc67-button">เพิ่มข้อมูล</button>
				</td>
			</tr>
			<tr>
				<td class="bold" width="15%" >รหัสติดลบข้ามปี : </td>
				<td>
					<input type="text" name="code" id="code" value=""/>
				</td>
			</tr>
			<tr>
				<td align="center" colspan="2">
					<button type="submit" name="search" id="search" class="acc67-button"> ค้นหาข้อมูล </button>
				</td>
			</tr>
		</table>
		<br/>
		<c:if test="${!empty pageBean.pageData}">
			<fieldset>
				<legend> ผลการค้นหาข้อมูล </legend>
				<table width="100%" class="acc67-grid ui-widget ui-widget-content">
					<tr>
						<th align="center" class="ui-state-default" onclick="pageControl('S', 'CODE');"><span id="CODE" class="ui-icon ui-icon-triangle-2-n-s" style="float: right;"></span>รหัสติดลบข้ามปี</th>
						<th align="center" class="ui-state-default" onclick="pageControl('S', 'APPLY');"><span id="APPLY" class="ui-icon ui-icon-triangle-2-n-s" style="float: right;"></span>สถานะ</th>
						<th align="center" class="ui-state-default" width="7%">แก้ไข</th>
						<th align="center" class="ui-state-default" width="7%">ลบ</th>
					</tr>
					<c:forEach items="${pageBean.pageData}" varStatus="x" var="data">
						<tr class="grid-tr-${x.count % 2}">
							<td>${data.code}</td>
							<td align="center">${data.apply == 'Y' ? 'ใช้งาน' : 'ไม่ใช้งาน'}</td>
							<td align="center">
								<button type="button" name="btnEdit" id="btnEdit" class="acc67-button" onclick="view('${data.code}')"/>
							</td>
							<td align="center">
								<button type="button" name="btnDel" id="btnDel" class="acc67-button" onclick="del('${data.code}')"/>
							</td>	
						</tr>
					</c:forEach>
					<input type="hidden" name="formPage" id="formPage" value="searchForm"/>
					<c:import url="/apps/page.jsp"/>
				</table>
			</fieldset>
		</c:if>
		</form>
	</body>
</html>